import Vue from "vue";
import App from "./App";
import router from "./router";
import Vuex from "vuex";
import store from "./store";
import axios from "@/assets/js/http";
import Scroll from "@/components/common/scroll/scroll";
import "../src/assets/js/flexible.js";
// import '@/assets/css/base.css'
import 'font-awesome/css/font-awesome.css'
import "@/assets/main.css";
import "@/assets/cover.css";

import XHeader from "vux/src/components/x-header/index.vue";
import Loading from "vux/src/components/loading/index.vue";
import LoadingPlugin from "vux/src/plugins/loading/index.js";
import XDialog from "vux/src/components/x-dialog/index.vue";
import Toast from "vux/src/components/toast/index.vue";
import ToastPlugin from "vux/src/plugins/toast/index.js";
import PopupRadio from "vux/src/components/popup-radio/index.vue";
import Icon from "vux/src/components/icon/index.vue";
import Group from "vux/src/components/group/index.vue";
import Cell from "vux/src/components/cell/index.vue";
import CellBox from "vux/src/components/cell-box/index.vue";
import XTextarea from "vux/src/components/x-textarea/index.vue";
import XInput from "vux/src/components/x-input/index.vue";
import XButton from "vux/src/components/x-button/index.vue";
import Flexbox from "vux/src/components/flexbox/flexbox.vue";
import FlexboxItem from "vux/src/components/flexbox/flexbox-item.vue";
import AlertPlugin from "vux/src/plugins/alert/index.js";
import ConfirmPlugin from "vux/src/plugins/confirm/index.js";
import TransferDom from "vux/src/directives/transfer-dom/index.js";
import Confirm from "vux/src/components/confirm/index.vue";
import Divider from "vux/src/components/divider/index.vue";
import Alert from "vux/src/components/alert/index.vue";
import PopupPicker from "vux/src/components/popup-picker/index.vue";
import InlineLoading from "vux/src/components/inline-loading/index.vue";
import Badge from "vux/src/components/badge/index.vue";

Vue.component("x-header", XHeader);
Vue.component("loading", Loading);
Vue.component("x-dialog", XDialog);
Vue.component("toast", Toast);
Vue.component("popup-radio", PopupRadio);
Vue.component("icon", Icon);
Vue.component("group", Group);
Vue.component("cell", Cell);
Vue.component("cell-box", CellBox);
Vue.component("x-input", XInput);
Vue.component("x-textarea", XTextarea);
Vue.component("x-button", XButton);
Vue.component("flexbox", Flexbox);
Vue.component("flexbox-item", FlexboxItem);
Vue.component("confirm", Confirm);
Vue.directive("transfer-dom", TransferDom);
Vue.component("divider", Divider);
Vue.component("alert", Alert);
Vue.component("popup-picker", PopupPicker);
Vue.component("scroll", Scroll);
Vue.component("inline-loading", InlineLoading);
Vue.component("badge", Badge);

Vue.use(ConfirmPlugin);
Vue.use(LoadingPlugin);
Vue.use(ConfirmPlugin);
Vue.use(AlertPlugin);
Vue.use(ToastPlugin, {
  // 默认参数
  width: "auto",
  position: "bottom",
  type: "text",
});
Vue.use(require("vue-wechat-title"));

if (
  window.location.host.indexOf("localhost") != -1 ||
  window.location.host.indexOf("192.") != -1
) {
  Vue.prototype.imgRequest = "http://qjw789.com";
  // Vue.prototype.imgRequest = "http://www.appbale.net";
} else {
  Vue.prototype.imgRequest = "http://qjw789.com";
  // Vue.prototype.imgRequest = window.location.origin;
}

Vue.prototype.$http = axios;
Vue.config.productionTip = false;

router.afterEach((route) => {
  window.scrollTo(0, 0);
});

/* eslint-disable no-new */
new Vue({
  el: "#app",
  router,
  store,
  render: (h) => h(App),
});

// WEBPACK FOOTER //
// ./src/main.js
